package qldc.pm.tienan.service.persistence;

import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InstanceFactory;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.UnmodifiableList;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.ModelListener;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;

import qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException;
import qldc.pm.tienan.model.PhieuThongTinVeNguoiCoTienAn;
import qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnImpl;
import qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnModelImpl;
import qldc.pm.tienan.service.persistence.PhieuThongTinVeNguoiCoTienAnPersistence;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The persistence implementation for the phieu thong tin ve nguoi co tien an service.
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author Brian Wing Shun Chan
 * @see PhieuThongTinVeNguoiCoTienAnPersistence
 * @see PhieuThongTinVeNguoiCoTienAnUtil
 * @generated
 */
public class PhieuThongTinVeNguoiCoTienAnPersistenceImpl
    extends BasePersistenceImpl<PhieuThongTinVeNguoiCoTienAn>
    implements PhieuThongTinVeNguoiCoTienAnPersistence {
    /*
     * NOTE FOR DEVELOPERS:
     *
     * Never modify or reference this class directly. Always use {@link PhieuThongTinVeNguoiCoTienAnUtil} to access the phieu thong tin ve nguoi co tien an persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
     */
    public static final String FINDER_CLASS_NAME_ENTITY = PhieuThongTinVeNguoiCoTienAnImpl.class.getName();
    public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
        ".List1";
    public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
        ".List2";
    public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
    public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
    public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll",
            new String[0]);
    public static final FinderPath FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class, FINDER_CLASS_NAME_ENTITY,
            "fetchByMaSoHoSoTienAnTuToaAn",
            new String[] { String.class.getName() },
            PhieuThongTinVeNguoiCoTienAnModelImpl.MASOHOSOTIENANTUTOAAN_COLUMN_BITMASK);
    public static final FinderPath FINDER_PATH_COUNT_BY_MASOHOSOTIENANTUTOAAN = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
            "countByMaSoHoSoTienAnTuToaAn",
            new String[] { String.class.getName() });
    private static final String _FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_1 =
        "phieuThongTinVeNguoiCoTienAn.maSoHoSoTienAnTuToaAn IS NULL";
    private static final String _FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_2 =
        "phieuThongTinVeNguoiCoTienAn.maSoHoSoTienAnTuToaAn = ?";
    private static final String _FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_3 =
        "(phieuThongTinVeNguoiCoTienAn.maSoHoSoTienAnTuToaAn IS NULL OR phieuThongTinVeNguoiCoTienAn.maSoHoSoTienAnTuToaAn = '')";
    public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_SODINHDANHCANHAN =
        new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findBySoDinhDanhCaNhan",
            new String[] {
                String.class.getName(),
                
            Integer.class.getName(), Integer.class.getName(),
                OrderByComparator.class.getName()
            });
    public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SODINHDANHCANHAN =
        new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
            "findBySoDinhDanhCaNhan", new String[] { String.class.getName() },
            PhieuThongTinVeNguoiCoTienAnModelImpl.SODINHDANHCANHAN_COLUMN_BITMASK |
            PhieuThongTinVeNguoiCoTienAnModelImpl.CREATEDATE_COLUMN_BITMASK);
    public static final FinderPath FINDER_PATH_COUNT_BY_SODINHDANHCANHAN = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
            "countBySoDinhDanhCaNhan", new String[] { String.class.getName() });
    private static final String _FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_1 =
        "phieuThongTinVeNguoiCoTienAn.soDinhDanhCaNhan IS NULL";
    private static final String _FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_2 =
        "phieuThongTinVeNguoiCoTienAn.soDinhDanhCaNhan = ?";
    private static final String _FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_3 =
        "(phieuThongTinVeNguoiCoTienAn.soDinhDanhCaNhan IS NULL OR phieuThongTinVeNguoiCoTienAn.soDinhDanhCaNhan = '')";
    public static final FinderPath FINDER_PATH_FETCH_BY_TIENANID = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class, FINDER_CLASS_NAME_ENTITY,
            "fetchByTienAnId", new String[] { Long.class.getName() },
            PhieuThongTinVeNguoiCoTienAnModelImpl.TIENANID_COLUMN_BITMASK);
    public static final FinderPath FINDER_PATH_COUNT_BY_TIENANID = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
            "countByTienAnId", new String[] { Long.class.getName() });
    private static final String _FINDER_COLUMN_TIENANID_TIENANID_2 = "phieuThongTinVeNguoiCoTienAn.tienAnId = ?";
    public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_DIACHI = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByDiaChi",
            new String[] {
                Long.class.getName(), Long.class.getName(), Long.class.getName(),
                String.class.getName(),
                
            Integer.class.getName(), Integer.class.getName(),
                OrderByComparator.class.getName()
            });
    public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DIACHI =
        new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByDiaChi",
            new String[] {
                Long.class.getName(), Long.class.getName(), Long.class.getName(),
                String.class.getName()
            },
            PhieuThongTinVeNguoiCoTienAnModelImpl.NOITHUONGTRUTINHID_COLUMN_BITMASK |
            PhieuThongTinVeNguoiCoTienAnModelImpl.NOITHUONGTRUQUANHUYENID_COLUMN_BITMASK |
            PhieuThongTinVeNguoiCoTienAnModelImpl.NOITHUONGTRUPHUONGXAID_COLUMN_BITMASK |
            PhieuThongTinVeNguoiCoTienAnModelImpl.NOITHUONGTRUDIACHI_COLUMN_BITMASK |
            PhieuThongTinVeNguoiCoTienAnModelImpl.CREATEDATE_COLUMN_BITMASK);
    public static final FinderPath FINDER_PATH_COUNT_BY_DIACHI = new FinderPath(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnModelImpl.FINDER_CACHE_ENABLED,
            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
            "countByDiaChi",
            new String[] {
                Long.class.getName(), Long.class.getName(), Long.class.getName(),
                String.class.getName()
            });
    private static final String _FINDER_COLUMN_DIACHI_NOITHUONGTRUTINHID_2 = "phieuThongTinVeNguoiCoTienAn.noiThuongTruTinhId = ? AND ";
    private static final String _FINDER_COLUMN_DIACHI_NOITHUONGTRUQUANHUYENID_2 = "phieuThongTinVeNguoiCoTienAn.noiThuongTruQuanHuyenId = ? AND ";
    private static final String _FINDER_COLUMN_DIACHI_NOITHUONGTRUPHUONGXAID_2 = "phieuThongTinVeNguoiCoTienAn.noiThuongTruPhuongXaId = ? AND ";
    private static final String _FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_1 = "phieuThongTinVeNguoiCoTienAn.noiThuongTruDiaChi IS NULL";
    private static final String _FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_2 = "phieuThongTinVeNguoiCoTienAn.noiThuongTruDiaChi = ?";
    private static final String _FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_3 = "(phieuThongTinVeNguoiCoTienAn.noiThuongTruDiaChi IS NULL OR phieuThongTinVeNguoiCoTienAn.noiThuongTruDiaChi = '')";
    private static final String _SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN = "SELECT phieuThongTinVeNguoiCoTienAn FROM PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn";
    private static final String _SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE = "SELECT phieuThongTinVeNguoiCoTienAn FROM PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn WHERE ";
    private static final String _SQL_COUNT_PHIEUTHONGTINVENGUOICOTIENAN = "SELECT COUNT(phieuThongTinVeNguoiCoTienAn) FROM PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn";
    private static final String _SQL_COUNT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE = "SELECT COUNT(phieuThongTinVeNguoiCoTienAn) FROM PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn WHERE ";
    private static final String _ORDER_BY_ENTITY_ALIAS = "phieuThongTinVeNguoiCoTienAn.";
    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PhieuThongTinVeNguoiCoTienAn exists with the primary key ";
    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PhieuThongTinVeNguoiCoTienAn exists with the key {";
    private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get(
                PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE));
    private static Log _log = LogFactoryUtil.getLog(PhieuThongTinVeNguoiCoTienAnPersistenceImpl.class);
    private static PhieuThongTinVeNguoiCoTienAn _nullPhieuThongTinVeNguoiCoTienAn =
        new PhieuThongTinVeNguoiCoTienAnImpl() {
            @Override
            public Object clone() {
                return this;
            }

            @Override
            public CacheModel<PhieuThongTinVeNguoiCoTienAn> toCacheModel() {
                return _nullPhieuThongTinVeNguoiCoTienAnCacheModel;
            }
        };

    private static CacheModel<PhieuThongTinVeNguoiCoTienAn> _nullPhieuThongTinVeNguoiCoTienAnCacheModel =
        new CacheModel<PhieuThongTinVeNguoiCoTienAn>() {
            @Override
            public PhieuThongTinVeNguoiCoTienAn toEntityModel() {
                return _nullPhieuThongTinVeNguoiCoTienAn;
            }
        };

    public PhieuThongTinVeNguoiCoTienAnPersistenceImpl() {
        setModelClass(PhieuThongTinVeNguoiCoTienAn.class);
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an where maSoHoSoTienAnTuToaAn = &#63; or throws a {@link qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException} if it could not be found.
     *
     * @param maSoHoSoTienAnTuToaAn the ma so ho so tien an tu toa an
     * @return the matching phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findByMaSoHoSoTienAnTuToaAn(
        String maSoHoSoTienAnTuToaAn)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = fetchByMaSoHoSoTienAnTuToaAn(maSoHoSoTienAnTuToaAn);

        if (phieuThongTinVeNguoiCoTienAn == null) {
            StringBundler msg = new StringBundler(4);

            msg.append(_NO_SUCH_ENTITY_WITH_KEY);

            msg.append("maSoHoSoTienAnTuToaAn=");
            msg.append(maSoHoSoTienAnTuToaAn);

            msg.append(StringPool.CLOSE_CURLY_BRACE);

            if (_log.isWarnEnabled()) {
                _log.warn(msg.toString());
            }

            throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(msg.toString());
        }

        return phieuThongTinVeNguoiCoTienAn;
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an where maSoHoSoTienAnTuToaAn = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
     *
     * @param maSoHoSoTienAnTuToaAn the ma so ho so tien an tu toa an
     * @return the matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByMaSoHoSoTienAnTuToaAn(
        String maSoHoSoTienAnTuToaAn) throws SystemException {
        return fetchByMaSoHoSoTienAnTuToaAn(maSoHoSoTienAnTuToaAn, true);
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an where maSoHoSoTienAnTuToaAn = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
     *
     * @param maSoHoSoTienAnTuToaAn the ma so ho so tien an tu toa an
     * @param retrieveFromCache whether to use the finder cache
     * @return the matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByMaSoHoSoTienAnTuToaAn(
        String maSoHoSoTienAnTuToaAn, boolean retrieveFromCache)
        throws SystemException {
        Object[] finderArgs = new Object[] { maSoHoSoTienAnTuToaAn };

        Object result = null;

        if (retrieveFromCache) {
            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
                    finderArgs, this);
        }

        if (result instanceof PhieuThongTinVeNguoiCoTienAn) {
            PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = (PhieuThongTinVeNguoiCoTienAn) result;

            if (!Validator.equals(maSoHoSoTienAnTuToaAn,
                        phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn())) {
                result = null;
            }
        }

        if (result == null) {
            StringBundler query = new StringBundler(3);

            query.append(_SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            boolean bindMaSoHoSoTienAnTuToaAn = false;

            if (maSoHoSoTienAnTuToaAn == null) {
                query.append(_FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_1);
            } else if (maSoHoSoTienAnTuToaAn.equals(StringPool.BLANK)) {
                query.append(_FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_3);
            } else {
                bindMaSoHoSoTienAnTuToaAn = true;

                query.append(_FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_2);
            }

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                if (bindMaSoHoSoTienAnTuToaAn) {
                    qPos.add(maSoHoSoTienAnTuToaAn);
                }

                List<PhieuThongTinVeNguoiCoTienAn> list = q.list();

                if (list.isEmpty()) {
                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
                        finderArgs, list);
                } else {
                    if ((list.size() > 1) && _log.isWarnEnabled()) {
                        _log.warn(
                            "PhieuThongTinVeNguoiCoTienAnPersistenceImpl.fetchByMaSoHoSoTienAnTuToaAn(String, boolean) with parameters (" +
                            StringUtil.merge(finderArgs) +
                            ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.");
                    }

                    PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = list.get(0);

                    result = phieuThongTinVeNguoiCoTienAn;

                    cacheResult(phieuThongTinVeNguoiCoTienAn);

                    if ((phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn() == null) ||
                            !phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn()
                                                             .equals(maSoHoSoTienAnTuToaAn)) {
                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
                            finderArgs, phieuThongTinVeNguoiCoTienAn);
                    }
                }
            } catch (Exception e) {
                FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
                    finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        if (result instanceof List<?>) {
            return null;
        } else {
            return (PhieuThongTinVeNguoiCoTienAn) result;
        }
    }

    /**
     * Removes the phieu thong tin ve nguoi co tien an where maSoHoSoTienAnTuToaAn = &#63; from the database.
     *
     * @param maSoHoSoTienAnTuToaAn the ma so ho so tien an tu toa an
     * @return the phieu thong tin ve nguoi co tien an that was removed
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn removeByMaSoHoSoTienAnTuToaAn(
        String maSoHoSoTienAnTuToaAn)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = findByMaSoHoSoTienAnTuToaAn(maSoHoSoTienAnTuToaAn);

        return remove(phieuThongTinVeNguoiCoTienAn);
    }

    /**
     * Returns the number of phieu thong tin ve nguoi co tien ans where maSoHoSoTienAnTuToaAn = &#63;.
     *
     * @param maSoHoSoTienAnTuToaAn the ma so ho so tien an tu toa an
     * @return the number of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public int countByMaSoHoSoTienAnTuToaAn(String maSoHoSoTienAnTuToaAn)
        throws SystemException {
        FinderPath finderPath = FINDER_PATH_COUNT_BY_MASOHOSOTIENANTUTOAAN;

        Object[] finderArgs = new Object[] { maSoHoSoTienAnTuToaAn };

        Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs,
                this);

        if (count == null) {
            StringBundler query = new StringBundler(2);

            query.append(_SQL_COUNT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            boolean bindMaSoHoSoTienAnTuToaAn = false;

            if (maSoHoSoTienAnTuToaAn == null) {
                query.append(_FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_1);
            } else if (maSoHoSoTienAnTuToaAn.equals(StringPool.BLANK)) {
                query.append(_FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_3);
            } else {
                bindMaSoHoSoTienAnTuToaAn = true;

                query.append(_FINDER_COLUMN_MASOHOSOTIENANTUTOAAN_MASOHOSOTIENANTUTOAAN_2);
            }

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                if (bindMaSoHoSoTienAnTuToaAn) {
                    qPos.add(maSoHoSoTienAnTuToaAn);
                }

                count = (Long) q.uniqueResult();

                FinderCacheUtil.putResult(finderPath, finderArgs, count);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return count.intValue();
    }

    /**
     * Returns all the phieu thong tin ve nguoi co tien ans where soDinhDanhCaNhan = &#63;.
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @return the matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findBySoDinhDanhCaNhan(
        String soDinhDanhCaNhan) throws SystemException {
        return findBySoDinhDanhCaNhan(soDinhDanhCaNhan, QueryUtil.ALL_POS,
            QueryUtil.ALL_POS, null);
    }

    /**
     * Returns a range of all the phieu thong tin ve nguoi co tien ans where soDinhDanhCaNhan = &#63;.
     *
     * <p>
     * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
     * </p>
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @param start the lower bound of the range of phieu thong tin ve nguoi co tien ans
     * @param end the upper bound of the range of phieu thong tin ve nguoi co tien ans (not inclusive)
     * @return the range of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findBySoDinhDanhCaNhan(
        String soDinhDanhCaNhan, int start, int end) throws SystemException {
        return findBySoDinhDanhCaNhan(soDinhDanhCaNhan, start, end, null);
    }

    /**
     * Returns an ordered range of all the phieu thong tin ve nguoi co tien ans where soDinhDanhCaNhan = &#63;.
     *
     * <p>
     * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
     * </p>
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @param start the lower bound of the range of phieu thong tin ve nguoi co tien ans
     * @param end the upper bound of the range of phieu thong tin ve nguoi co tien ans (not inclusive)
     * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
     * @return the ordered range of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findBySoDinhDanhCaNhan(
        String soDinhDanhCaNhan, int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
        boolean pagination = true;
        FinderPath finderPath = null;
        Object[] finderArgs = null;

        if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
                (orderByComparator == null)) {
            pagination = false;
            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SODINHDANHCANHAN;
            finderArgs = new Object[] { soDinhDanhCaNhan };
        } else {
            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_SODINHDANHCANHAN;
            finderArgs = new Object[] {
                    soDinhDanhCaNhan,
                    
                    start, end, orderByComparator
                };
        }

        List<PhieuThongTinVeNguoiCoTienAn> list = (List<PhieuThongTinVeNguoiCoTienAn>) FinderCacheUtil.getResult(finderPath,
                finderArgs, this);

        if ((list != null) && !list.isEmpty()) {
            for (PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn : list) {
                if (!Validator.equals(soDinhDanhCaNhan,
                            phieuThongTinVeNguoiCoTienAn.getSoDinhDanhCaNhan())) {
                    list = null;

                    break;
                }
            }
        }

        if (list == null) {
            StringBundler query = null;

            if (orderByComparator != null) {
                query = new StringBundler(3 +
                        (orderByComparator.getOrderByFields().length * 3));
            } else {
                query = new StringBundler(3);
            }

            query.append(_SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            boolean bindSoDinhDanhCaNhan = false;

            if (soDinhDanhCaNhan == null) {
                query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_1);
            } else if (soDinhDanhCaNhan.equals(StringPool.BLANK)) {
                query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_3);
            } else {
                bindSoDinhDanhCaNhan = true;

                query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_2);
            }

            if (orderByComparator != null) {
                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
                    orderByComparator);
            } else
             if (pagination) {
                query.append(PhieuThongTinVeNguoiCoTienAnModelImpl.ORDER_BY_JPQL);
            }

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                if (bindSoDinhDanhCaNhan) {
                    qPos.add(soDinhDanhCaNhan);
                }

                if (!pagination) {
                    list = (List<PhieuThongTinVeNguoiCoTienAn>) QueryUtil.list(q,
                            getDialect(), start, end, false);

                    Collections.sort(list);

                    list = new UnmodifiableList<PhieuThongTinVeNguoiCoTienAn>(list);
                } else {
                    list = (List<PhieuThongTinVeNguoiCoTienAn>) QueryUtil.list(q,
                            getDialect(), start, end);
                }

                cacheResult(list);

                FinderCacheUtil.putResult(finderPath, finderArgs, list);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return list;
    }

    /**
     * Returns the first phieu thong tin ve nguoi co tien an in the ordered set where soDinhDanhCaNhan = &#63;.
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the first matching phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findBySoDinhDanhCaNhan_First(
        String soDinhDanhCaNhan, OrderByComparator orderByComparator)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = fetchBySoDinhDanhCaNhan_First(soDinhDanhCaNhan,
                orderByComparator);

        if (phieuThongTinVeNguoiCoTienAn != null) {
            return phieuThongTinVeNguoiCoTienAn;
        }

        StringBundler msg = new StringBundler(4);

        msg.append(_NO_SUCH_ENTITY_WITH_KEY);

        msg.append("soDinhDanhCaNhan=");
        msg.append(soDinhDanhCaNhan);

        msg.append(StringPool.CLOSE_CURLY_BRACE);

        throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(msg.toString());
    }

    /**
     * Returns the first phieu thong tin ve nguoi co tien an in the ordered set where soDinhDanhCaNhan = &#63;.
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the first matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchBySoDinhDanhCaNhan_First(
        String soDinhDanhCaNhan, OrderByComparator orderByComparator)
        throws SystemException {
        List<PhieuThongTinVeNguoiCoTienAn> list = findBySoDinhDanhCaNhan(soDinhDanhCaNhan,
                0, 1, orderByComparator);

        if (!list.isEmpty()) {
            return list.get(0);
        }

        return null;
    }

    /**
     * Returns the last phieu thong tin ve nguoi co tien an in the ordered set where soDinhDanhCaNhan = &#63;.
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the last matching phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findBySoDinhDanhCaNhan_Last(
        String soDinhDanhCaNhan, OrderByComparator orderByComparator)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = fetchBySoDinhDanhCaNhan_Last(soDinhDanhCaNhan,
                orderByComparator);

        if (phieuThongTinVeNguoiCoTienAn != null) {
            return phieuThongTinVeNguoiCoTienAn;
        }

        StringBundler msg = new StringBundler(4);

        msg.append(_NO_SUCH_ENTITY_WITH_KEY);

        msg.append("soDinhDanhCaNhan=");
        msg.append(soDinhDanhCaNhan);

        msg.append(StringPool.CLOSE_CURLY_BRACE);

        throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(msg.toString());
    }

    /**
     * Returns the last phieu thong tin ve nguoi co tien an in the ordered set where soDinhDanhCaNhan = &#63;.
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the last matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchBySoDinhDanhCaNhan_Last(
        String soDinhDanhCaNhan, OrderByComparator orderByComparator)
        throws SystemException {
        int count = countBySoDinhDanhCaNhan(soDinhDanhCaNhan);

        if (count == 0) {
            return null;
        }

        List<PhieuThongTinVeNguoiCoTienAn> list = findBySoDinhDanhCaNhan(soDinhDanhCaNhan,
                count - 1, count, orderByComparator);

        if (!list.isEmpty()) {
            return list.get(0);
        }

        return null;
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien ans before and after the current phieu thong tin ve nguoi co tien an in the ordered set where soDinhDanhCaNhan = &#63;.
     *
     * @param phieuThongTinVeNguoiCoTienAnId the primary key of the current phieu thong tin ve nguoi co tien an
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the previous, current, and next phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn[] findBySoDinhDanhCaNhan_PrevAndNext(
        long phieuThongTinVeNguoiCoTienAnId, String soDinhDanhCaNhan,
        OrderByComparator orderByComparator)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = findByPrimaryKey(phieuThongTinVeNguoiCoTienAnId);

        Session session = null;

        try {
            session = openSession();

            PhieuThongTinVeNguoiCoTienAn[] array = new PhieuThongTinVeNguoiCoTienAnImpl[3];

            array[0] = getBySoDinhDanhCaNhan_PrevAndNext(session,
                    phieuThongTinVeNguoiCoTienAn, soDinhDanhCaNhan,
                    orderByComparator, true);

            array[1] = phieuThongTinVeNguoiCoTienAn;

            array[2] = getBySoDinhDanhCaNhan_PrevAndNext(session,
                    phieuThongTinVeNguoiCoTienAn, soDinhDanhCaNhan,
                    orderByComparator, false);

            return array;
        } catch (Exception e) {
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }

    protected PhieuThongTinVeNguoiCoTienAn getBySoDinhDanhCaNhan_PrevAndNext(
        Session session,
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn,
        String soDinhDanhCaNhan, OrderByComparator orderByComparator,
        boolean previous) {
        StringBundler query = null;

        if (orderByComparator != null) {
            query = new StringBundler(6 +
                    (orderByComparator.getOrderByFields().length * 6));
        } else {
            query = new StringBundler(3);
        }

        query.append(_SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

        boolean bindSoDinhDanhCaNhan = false;

        if (soDinhDanhCaNhan == null) {
            query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_1);
        } else if (soDinhDanhCaNhan.equals(StringPool.BLANK)) {
            query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_3);
        } else {
            bindSoDinhDanhCaNhan = true;

            query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_2);
        }

        if (orderByComparator != null) {
            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

            if (orderByConditionFields.length > 0) {
                query.append(WHERE_AND);
            }

            for (int i = 0; i < orderByConditionFields.length; i++) {
                query.append(_ORDER_BY_ENTITY_ALIAS);
                query.append(orderByConditionFields[i]);

                if ((i + 1) < orderByConditionFields.length) {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
                    } else {
                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
                    }
                } else {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(WHERE_GREATER_THAN);
                    } else {
                        query.append(WHERE_LESSER_THAN);
                    }
                }
            }

            query.append(ORDER_BY_CLAUSE);

            String[] orderByFields = orderByComparator.getOrderByFields();

            for (int i = 0; i < orderByFields.length; i++) {
                query.append(_ORDER_BY_ENTITY_ALIAS);
                query.append(orderByFields[i]);

                if ((i + 1) < orderByFields.length) {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(ORDER_BY_ASC_HAS_NEXT);
                    } else {
                        query.append(ORDER_BY_DESC_HAS_NEXT);
                    }
                } else {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(ORDER_BY_ASC);
                    } else {
                        query.append(ORDER_BY_DESC);
                    }
                }
            }
        } else {
            query.append(PhieuThongTinVeNguoiCoTienAnModelImpl.ORDER_BY_JPQL);
        }

        String sql = query.toString();

        Query q = session.createQuery(sql);

        q.setFirstResult(0);
        q.setMaxResults(2);

        QueryPos qPos = QueryPos.getInstance(q);

        if (bindSoDinhDanhCaNhan) {
            qPos.add(soDinhDanhCaNhan);
        }

        if (orderByComparator != null) {
            Object[] values = orderByComparator.getOrderByConditionValues(phieuThongTinVeNguoiCoTienAn);

            for (Object value : values) {
                qPos.add(value);
            }
        }

        List<PhieuThongTinVeNguoiCoTienAn> list = q.list();

        if (list.size() == 2) {
            return list.get(1);
        } else {
            return null;
        }
    }

    /**
     * Removes all the phieu thong tin ve nguoi co tien ans where soDinhDanhCaNhan = &#63; from the database.
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @throws SystemException if a system exception occurred
     */
    @Override
    public void removeBySoDinhDanhCaNhan(String soDinhDanhCaNhan)
        throws SystemException {
        for (PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn : findBySoDinhDanhCaNhan(
                soDinhDanhCaNhan, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
            remove(phieuThongTinVeNguoiCoTienAn);
        }
    }

    /**
     * Returns the number of phieu thong tin ve nguoi co tien ans where soDinhDanhCaNhan = &#63;.
     *
     * @param soDinhDanhCaNhan the so dinh danh ca nhan
     * @return the number of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public int countBySoDinhDanhCaNhan(String soDinhDanhCaNhan)
        throws SystemException {
        FinderPath finderPath = FINDER_PATH_COUNT_BY_SODINHDANHCANHAN;

        Object[] finderArgs = new Object[] { soDinhDanhCaNhan };

        Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs,
                this);

        if (count == null) {
            StringBundler query = new StringBundler(2);

            query.append(_SQL_COUNT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            boolean bindSoDinhDanhCaNhan = false;

            if (soDinhDanhCaNhan == null) {
                query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_1);
            } else if (soDinhDanhCaNhan.equals(StringPool.BLANK)) {
                query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_3);
            } else {
                bindSoDinhDanhCaNhan = true;

                query.append(_FINDER_COLUMN_SODINHDANHCANHAN_SODINHDANHCANHAN_2);
            }

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                if (bindSoDinhDanhCaNhan) {
                    qPos.add(soDinhDanhCaNhan);
                }

                count = (Long) q.uniqueResult();

                FinderCacheUtil.putResult(finderPath, finderArgs, count);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return count.intValue();
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an where tienAnId = &#63; or throws a {@link qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException} if it could not be found.
     *
     * @param tienAnId the tien an ID
     * @return the matching phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findByTienAnId(long tienAnId)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = fetchByTienAnId(tienAnId);

        if (phieuThongTinVeNguoiCoTienAn == null) {
            StringBundler msg = new StringBundler(4);

            msg.append(_NO_SUCH_ENTITY_WITH_KEY);

            msg.append("tienAnId=");
            msg.append(tienAnId);

            msg.append(StringPool.CLOSE_CURLY_BRACE);

            if (_log.isWarnEnabled()) {
                _log.warn(msg.toString());
            }

            throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(msg.toString());
        }

        return phieuThongTinVeNguoiCoTienAn;
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an where tienAnId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
     *
     * @param tienAnId the tien an ID
     * @return the matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByTienAnId(long tienAnId)
        throws SystemException {
        return fetchByTienAnId(tienAnId, true);
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an where tienAnId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
     *
     * @param tienAnId the tien an ID
     * @param retrieveFromCache whether to use the finder cache
     * @return the matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByTienAnId(long tienAnId,
        boolean retrieveFromCache) throws SystemException {
        Object[] finderArgs = new Object[] { tienAnId };

        Object result = null;

        if (retrieveFromCache) {
            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_TIENANID,
                    finderArgs, this);
        }

        if (result instanceof PhieuThongTinVeNguoiCoTienAn) {
            PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = (PhieuThongTinVeNguoiCoTienAn) result;

            if ((tienAnId != phieuThongTinVeNguoiCoTienAn.getTienAnId())) {
                result = null;
            }
        }

        if (result == null) {
            StringBundler query = new StringBundler(3);

            query.append(_SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            query.append(_FINDER_COLUMN_TIENANID_TIENANID_2);

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                qPos.add(tienAnId);

                List<PhieuThongTinVeNguoiCoTienAn> list = q.list();

                if (list.isEmpty()) {
                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_TIENANID,
                        finderArgs, list);
                } else {
                    if ((list.size() > 1) && _log.isWarnEnabled()) {
                        _log.warn(
                            "PhieuThongTinVeNguoiCoTienAnPersistenceImpl.fetchByTienAnId(long, boolean) with parameters (" +
                            StringUtil.merge(finderArgs) +
                            ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.");
                    }

                    PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = list.get(0);

                    result = phieuThongTinVeNguoiCoTienAn;

                    cacheResult(phieuThongTinVeNguoiCoTienAn);

                    if ((phieuThongTinVeNguoiCoTienAn.getTienAnId() != tienAnId)) {
                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_TIENANID,
                            finderArgs, phieuThongTinVeNguoiCoTienAn);
                    }
                }
            } catch (Exception e) {
                FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_TIENANID,
                    finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        if (result instanceof List<?>) {
            return null;
        } else {
            return (PhieuThongTinVeNguoiCoTienAn) result;
        }
    }

    /**
     * Removes the phieu thong tin ve nguoi co tien an where tienAnId = &#63; from the database.
     *
     * @param tienAnId the tien an ID
     * @return the phieu thong tin ve nguoi co tien an that was removed
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn removeByTienAnId(long tienAnId)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = findByTienAnId(tienAnId);

        return remove(phieuThongTinVeNguoiCoTienAn);
    }

    /**
     * Returns the number of phieu thong tin ve nguoi co tien ans where tienAnId = &#63;.
     *
     * @param tienAnId the tien an ID
     * @return the number of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public int countByTienAnId(long tienAnId) throws SystemException {
        FinderPath finderPath = FINDER_PATH_COUNT_BY_TIENANID;

        Object[] finderArgs = new Object[] { tienAnId };

        Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs,
                this);

        if (count == null) {
            StringBundler query = new StringBundler(2);

            query.append(_SQL_COUNT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            query.append(_FINDER_COLUMN_TIENANID_TIENANID_2);

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                qPos.add(tienAnId);

                count = (Long) q.uniqueResult();

                FinderCacheUtil.putResult(finderPath, finderArgs, count);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return count.intValue();
    }

    /**
     * Returns all the phieu thong tin ve nguoi co tien ans where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @return the matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findByDiaChi(
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi)
        throws SystemException {
        return findByDiaChi(noiThuongTruTinhId, noiThuongTruQuanHuyenId,
            noiThuongTruPhuongXaId, noiThuongTruDiaChi, QueryUtil.ALL_POS,
            QueryUtil.ALL_POS, null);
    }

    /**
     * Returns a range of all the phieu thong tin ve nguoi co tien ans where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * <p>
     * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
     * </p>
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @param start the lower bound of the range of phieu thong tin ve nguoi co tien ans
     * @param end the upper bound of the range of phieu thong tin ve nguoi co tien ans (not inclusive)
     * @return the range of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findByDiaChi(
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi, int start,
        int end) throws SystemException {
        return findByDiaChi(noiThuongTruTinhId, noiThuongTruQuanHuyenId,
            noiThuongTruPhuongXaId, noiThuongTruDiaChi, start, end, null);
    }

    /**
     * Returns an ordered range of all the phieu thong tin ve nguoi co tien ans where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * <p>
     * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
     * </p>
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @param start the lower bound of the range of phieu thong tin ve nguoi co tien ans
     * @param end the upper bound of the range of phieu thong tin ve nguoi co tien ans (not inclusive)
     * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
     * @return the ordered range of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findByDiaChi(
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi, int start,
        int end, OrderByComparator orderByComparator) throws SystemException {
        boolean pagination = true;
        FinderPath finderPath = null;
        Object[] finderArgs = null;

        if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
                (orderByComparator == null)) {
            pagination = false;
            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DIACHI;
            finderArgs = new Object[] {
                    noiThuongTruTinhId, noiThuongTruQuanHuyenId,
                    noiThuongTruPhuongXaId, noiThuongTruDiaChi
                };
        } else {
            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_DIACHI;
            finderArgs = new Object[] {
                    noiThuongTruTinhId, noiThuongTruQuanHuyenId,
                    noiThuongTruPhuongXaId, noiThuongTruDiaChi,
                    
                    start, end, orderByComparator
                };
        }

        List<PhieuThongTinVeNguoiCoTienAn> list = (List<PhieuThongTinVeNguoiCoTienAn>) FinderCacheUtil.getResult(finderPath,
                finderArgs, this);

        if ((list != null) && !list.isEmpty()) {
            for (PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn : list) {
                if ((noiThuongTruTinhId != phieuThongTinVeNguoiCoTienAn.getNoiThuongTruTinhId()) ||
                        (noiThuongTruQuanHuyenId != phieuThongTinVeNguoiCoTienAn.getNoiThuongTruQuanHuyenId()) ||
                        (noiThuongTruPhuongXaId != phieuThongTinVeNguoiCoTienAn.getNoiThuongTruPhuongXaId()) ||
                        !Validator.equals(noiThuongTruDiaChi,
                            phieuThongTinVeNguoiCoTienAn.getNoiThuongTruDiaChi())) {
                    list = null;

                    break;
                }
            }
        }

        if (list == null) {
            StringBundler query = null;

            if (orderByComparator != null) {
                query = new StringBundler(6 +
                        (orderByComparator.getOrderByFields().length * 3));
            } else {
                query = new StringBundler(6);
            }

            query.append(_SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUTINHID_2);

            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUQUANHUYENID_2);

            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUPHUONGXAID_2);

            boolean bindNoiThuongTruDiaChi = false;

            if (noiThuongTruDiaChi == null) {
                query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_1);
            } else if (noiThuongTruDiaChi.equals(StringPool.BLANK)) {
                query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_3);
            } else {
                bindNoiThuongTruDiaChi = true;

                query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_2);
            }

            if (orderByComparator != null) {
                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
                    orderByComparator);
            } else
             if (pagination) {
                query.append(PhieuThongTinVeNguoiCoTienAnModelImpl.ORDER_BY_JPQL);
            }

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                qPos.add(noiThuongTruTinhId);

                qPos.add(noiThuongTruQuanHuyenId);

                qPos.add(noiThuongTruPhuongXaId);

                if (bindNoiThuongTruDiaChi) {
                    qPos.add(noiThuongTruDiaChi);
                }

                if (!pagination) {
                    list = (List<PhieuThongTinVeNguoiCoTienAn>) QueryUtil.list(q,
                            getDialect(), start, end, false);

                    Collections.sort(list);

                    list = new UnmodifiableList<PhieuThongTinVeNguoiCoTienAn>(list);
                } else {
                    list = (List<PhieuThongTinVeNguoiCoTienAn>) QueryUtil.list(q,
                            getDialect(), start, end);
                }

                cacheResult(list);

                FinderCacheUtil.putResult(finderPath, finderArgs, list);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return list;
    }

    /**
     * Returns the first phieu thong tin ve nguoi co tien an in the ordered set where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the first matching phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findByDiaChi_First(
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi,
        OrderByComparator orderByComparator)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = fetchByDiaChi_First(noiThuongTruTinhId,
                noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
                noiThuongTruDiaChi, orderByComparator);

        if (phieuThongTinVeNguoiCoTienAn != null) {
            return phieuThongTinVeNguoiCoTienAn;
        }

        StringBundler msg = new StringBundler(10);

        msg.append(_NO_SUCH_ENTITY_WITH_KEY);

        msg.append("noiThuongTruTinhId=");
        msg.append(noiThuongTruTinhId);

        msg.append(", noiThuongTruQuanHuyenId=");
        msg.append(noiThuongTruQuanHuyenId);

        msg.append(", noiThuongTruPhuongXaId=");
        msg.append(noiThuongTruPhuongXaId);

        msg.append(", noiThuongTruDiaChi=");
        msg.append(noiThuongTruDiaChi);

        msg.append(StringPool.CLOSE_CURLY_BRACE);

        throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(msg.toString());
    }

    /**
     * Returns the first phieu thong tin ve nguoi co tien an in the ordered set where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the first matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByDiaChi_First(
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi,
        OrderByComparator orderByComparator) throws SystemException {
        List<PhieuThongTinVeNguoiCoTienAn> list = findByDiaChi(noiThuongTruTinhId,
                noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
                noiThuongTruDiaChi, 0, 1, orderByComparator);

        if (!list.isEmpty()) {
            return list.get(0);
        }

        return null;
    }

    /**
     * Returns the last phieu thong tin ve nguoi co tien an in the ordered set where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the last matching phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findByDiaChi_Last(
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi,
        OrderByComparator orderByComparator)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = fetchByDiaChi_Last(noiThuongTruTinhId,
                noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
                noiThuongTruDiaChi, orderByComparator);

        if (phieuThongTinVeNguoiCoTienAn != null) {
            return phieuThongTinVeNguoiCoTienAn;
        }

        StringBundler msg = new StringBundler(10);

        msg.append(_NO_SUCH_ENTITY_WITH_KEY);

        msg.append("noiThuongTruTinhId=");
        msg.append(noiThuongTruTinhId);

        msg.append(", noiThuongTruQuanHuyenId=");
        msg.append(noiThuongTruQuanHuyenId);

        msg.append(", noiThuongTruPhuongXaId=");
        msg.append(noiThuongTruPhuongXaId);

        msg.append(", noiThuongTruDiaChi=");
        msg.append(noiThuongTruDiaChi);

        msg.append(StringPool.CLOSE_CURLY_BRACE);

        throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(msg.toString());
    }

    /**
     * Returns the last phieu thong tin ve nguoi co tien an in the ordered set where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the last matching phieu thong tin ve nguoi co tien an, or <code>null</code> if a matching phieu thong tin ve nguoi co tien an could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByDiaChi_Last(
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi,
        OrderByComparator orderByComparator) throws SystemException {
        int count = countByDiaChi(noiThuongTruTinhId, noiThuongTruQuanHuyenId,
                noiThuongTruPhuongXaId, noiThuongTruDiaChi);

        if (count == 0) {
            return null;
        }

        List<PhieuThongTinVeNguoiCoTienAn> list = findByDiaChi(noiThuongTruTinhId,
                noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
                noiThuongTruDiaChi, count - 1, count, orderByComparator);

        if (!list.isEmpty()) {
            return list.get(0);
        }

        return null;
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien ans before and after the current phieu thong tin ve nguoi co tien an in the ordered set where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * @param phieuThongTinVeNguoiCoTienAnId the primary key of the current phieu thong tin ve nguoi co tien an
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
     * @return the previous, current, and next phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn[] findByDiaChi_PrevAndNext(
        long phieuThongTinVeNguoiCoTienAnId, long noiThuongTruTinhId,
        long noiThuongTruQuanHuyenId, long noiThuongTruPhuongXaId,
        String noiThuongTruDiaChi, OrderByComparator orderByComparator)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = findByPrimaryKey(phieuThongTinVeNguoiCoTienAnId);

        Session session = null;

        try {
            session = openSession();

            PhieuThongTinVeNguoiCoTienAn[] array = new PhieuThongTinVeNguoiCoTienAnImpl[3];

            array[0] = getByDiaChi_PrevAndNext(session,
                    phieuThongTinVeNguoiCoTienAn, noiThuongTruTinhId,
                    noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
                    noiThuongTruDiaChi, orderByComparator, true);

            array[1] = phieuThongTinVeNguoiCoTienAn;

            array[2] = getByDiaChi_PrevAndNext(session,
                    phieuThongTinVeNguoiCoTienAn, noiThuongTruTinhId,
                    noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
                    noiThuongTruDiaChi, orderByComparator, false);

            return array;
        } catch (Exception e) {
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }

    protected PhieuThongTinVeNguoiCoTienAn getByDiaChi_PrevAndNext(
        Session session,
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn,
        long noiThuongTruTinhId, long noiThuongTruQuanHuyenId,
        long noiThuongTruPhuongXaId, String noiThuongTruDiaChi,
        OrderByComparator orderByComparator, boolean previous) {
        StringBundler query = null;

        if (orderByComparator != null) {
            query = new StringBundler(6 +
                    (orderByComparator.getOrderByFields().length * 6));
        } else {
            query = new StringBundler(3);
        }

        query.append(_SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

        query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUTINHID_2);

        query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUQUANHUYENID_2);

        query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUPHUONGXAID_2);

        boolean bindNoiThuongTruDiaChi = false;

        if (noiThuongTruDiaChi == null) {
            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_1);
        } else if (noiThuongTruDiaChi.equals(StringPool.BLANK)) {
            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_3);
        } else {
            bindNoiThuongTruDiaChi = true;

            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_2);
        }

        if (orderByComparator != null) {
            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

            if (orderByConditionFields.length > 0) {
                query.append(WHERE_AND);
            }

            for (int i = 0; i < orderByConditionFields.length; i++) {
                query.append(_ORDER_BY_ENTITY_ALIAS);
                query.append(orderByConditionFields[i]);

                if ((i + 1) < orderByConditionFields.length) {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(WHERE_GREATER_THAN_HAS_NEXT);
                    } else {
                        query.append(WHERE_LESSER_THAN_HAS_NEXT);
                    }
                } else {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(WHERE_GREATER_THAN);
                    } else {
                        query.append(WHERE_LESSER_THAN);
                    }
                }
            }

            query.append(ORDER_BY_CLAUSE);

            String[] orderByFields = orderByComparator.getOrderByFields();

            for (int i = 0; i < orderByFields.length; i++) {
                query.append(_ORDER_BY_ENTITY_ALIAS);
                query.append(orderByFields[i]);

                if ((i + 1) < orderByFields.length) {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(ORDER_BY_ASC_HAS_NEXT);
                    } else {
                        query.append(ORDER_BY_DESC_HAS_NEXT);
                    }
                } else {
                    if (orderByComparator.isAscending() ^ previous) {
                        query.append(ORDER_BY_ASC);
                    } else {
                        query.append(ORDER_BY_DESC);
                    }
                }
            }
        } else {
            query.append(PhieuThongTinVeNguoiCoTienAnModelImpl.ORDER_BY_JPQL);
        }

        String sql = query.toString();

        Query q = session.createQuery(sql);

        q.setFirstResult(0);
        q.setMaxResults(2);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(noiThuongTruTinhId);

        qPos.add(noiThuongTruQuanHuyenId);

        qPos.add(noiThuongTruPhuongXaId);

        if (bindNoiThuongTruDiaChi) {
            qPos.add(noiThuongTruDiaChi);
        }

        if (orderByComparator != null) {
            Object[] values = orderByComparator.getOrderByConditionValues(phieuThongTinVeNguoiCoTienAn);

            for (Object value : values) {
                qPos.add(value);
            }
        }

        List<PhieuThongTinVeNguoiCoTienAn> list = q.list();

        if (list.size() == 2) {
            return list.get(1);
        } else {
            return null;
        }
    }

    /**
     * Removes all the phieu thong tin ve nguoi co tien ans where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63; from the database.
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @throws SystemException if a system exception occurred
     */
    @Override
    public void removeByDiaChi(long noiThuongTruTinhId,
        long noiThuongTruQuanHuyenId, long noiThuongTruPhuongXaId,
        String noiThuongTruDiaChi) throws SystemException {
        for (PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn : findByDiaChi(
                noiThuongTruTinhId, noiThuongTruQuanHuyenId,
                noiThuongTruPhuongXaId, noiThuongTruDiaChi, QueryUtil.ALL_POS,
                QueryUtil.ALL_POS, null)) {
            remove(phieuThongTinVeNguoiCoTienAn);
        }
    }

    /**
     * Returns the number of phieu thong tin ve nguoi co tien ans where noiThuongTruTinhId = &#63; and noiThuongTruQuanHuyenId = &#63; and noiThuongTruPhuongXaId = &#63; and noiThuongTruDiaChi = &#63;.
     *
     * @param noiThuongTruTinhId the noi thuong tru tinh ID
     * @param noiThuongTruQuanHuyenId the noi thuong tru quan huyen ID
     * @param noiThuongTruPhuongXaId the noi thuong tru phuong xa ID
     * @param noiThuongTruDiaChi the noi thuong tru dia chi
     * @return the number of matching phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public int countByDiaChi(long noiThuongTruTinhId,
        long noiThuongTruQuanHuyenId, long noiThuongTruPhuongXaId,
        String noiThuongTruDiaChi) throws SystemException {
        FinderPath finderPath = FINDER_PATH_COUNT_BY_DIACHI;

        Object[] finderArgs = new Object[] {
                noiThuongTruTinhId, noiThuongTruQuanHuyenId,
                noiThuongTruPhuongXaId, noiThuongTruDiaChi
            };

        Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs,
                this);

        if (count == null) {
            StringBundler query = new StringBundler(5);

            query.append(_SQL_COUNT_PHIEUTHONGTINVENGUOICOTIENAN_WHERE);

            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUTINHID_2);

            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUQUANHUYENID_2);

            query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUPHUONGXAID_2);

            boolean bindNoiThuongTruDiaChi = false;

            if (noiThuongTruDiaChi == null) {
                query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_1);
            } else if (noiThuongTruDiaChi.equals(StringPool.BLANK)) {
                query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_3);
            } else {
                bindNoiThuongTruDiaChi = true;

                query.append(_FINDER_COLUMN_DIACHI_NOITHUONGTRUDIACHI_2);
            }

            String sql = query.toString();

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                QueryPos qPos = QueryPos.getInstance(q);

                qPos.add(noiThuongTruTinhId);

                qPos.add(noiThuongTruQuanHuyenId);

                qPos.add(noiThuongTruPhuongXaId);

                if (bindNoiThuongTruDiaChi) {
                    qPos.add(noiThuongTruDiaChi);
                }

                count = (Long) q.uniqueResult();

                FinderCacheUtil.putResult(finderPath, finderArgs, count);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return count.intValue();
    }

    /**
     * Caches the phieu thong tin ve nguoi co tien an in the entity cache if it is enabled.
     *
     * @param phieuThongTinVeNguoiCoTienAn the phieu thong tin ve nguoi co tien an
     */
    @Override
    public void cacheResult(
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn) {
        EntityCacheUtil.putResult(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            phieuThongTinVeNguoiCoTienAn.getPrimaryKey(),
            phieuThongTinVeNguoiCoTienAn);

        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
            new Object[] { phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn() },
            phieuThongTinVeNguoiCoTienAn);

        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_TIENANID,
            new Object[] { phieuThongTinVeNguoiCoTienAn.getTienAnId() },
            phieuThongTinVeNguoiCoTienAn);

        phieuThongTinVeNguoiCoTienAn.resetOriginalValues();
    }

    /**
     * Caches the phieu thong tin ve nguoi co tien ans in the entity cache if it is enabled.
     *
     * @param phieuThongTinVeNguoiCoTienAns the phieu thong tin ve nguoi co tien ans
     */
    @Override
    public void cacheResult(
        List<PhieuThongTinVeNguoiCoTienAn> phieuThongTinVeNguoiCoTienAns) {
        for (PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn : phieuThongTinVeNguoiCoTienAns) {
            if (EntityCacheUtil.getResult(
                        PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
                        PhieuThongTinVeNguoiCoTienAnImpl.class,
                        phieuThongTinVeNguoiCoTienAn.getPrimaryKey()) == null) {
                cacheResult(phieuThongTinVeNguoiCoTienAn);
            } else {
                phieuThongTinVeNguoiCoTienAn.resetOriginalValues();
            }
        }
    }

    /**
     * Clears the cache for all phieu thong tin ve nguoi co tien ans.
     *
     * <p>
     * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
     * </p>
     */
    @Override
    public void clearCache() {
        if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
            CacheRegistryUtil.clear(PhieuThongTinVeNguoiCoTienAnImpl.class.getName());
        }

        EntityCacheUtil.clearCache(PhieuThongTinVeNguoiCoTienAnImpl.class.getName());

        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }

    /**
     * Clears the cache for the phieu thong tin ve nguoi co tien an.
     *
     * <p>
     * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
     * </p>
     */
    @Override
    public void clearCache(
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn) {
        EntityCacheUtil.removeResult(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            phieuThongTinVeNguoiCoTienAn.getPrimaryKey());

        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

        clearUniqueFindersCache(phieuThongTinVeNguoiCoTienAn);
    }

    @Override
    public void clearCache(
        List<PhieuThongTinVeNguoiCoTienAn> phieuThongTinVeNguoiCoTienAns) {
        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

        for (PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn : phieuThongTinVeNguoiCoTienAns) {
            EntityCacheUtil.removeResult(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
                PhieuThongTinVeNguoiCoTienAnImpl.class,
                phieuThongTinVeNguoiCoTienAn.getPrimaryKey());

            clearUniqueFindersCache(phieuThongTinVeNguoiCoTienAn);
        }
    }

    protected void cacheUniqueFindersCache(
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn) {
        if (phieuThongTinVeNguoiCoTienAn.isNew()) {
            Object[] args = new Object[] {
                    phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn()
                };

            FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_MASOHOSOTIENANTUTOAAN,
                args, Long.valueOf(1));
            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
                args, phieuThongTinVeNguoiCoTienAn);

            args = new Object[] { phieuThongTinVeNguoiCoTienAn.getTienAnId() };

            FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TIENANID, args,
                Long.valueOf(1));
            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_TIENANID, args,
                phieuThongTinVeNguoiCoTienAn);
        } else {
            PhieuThongTinVeNguoiCoTienAnModelImpl phieuThongTinVeNguoiCoTienAnModelImpl =
                (PhieuThongTinVeNguoiCoTienAnModelImpl) phieuThongTinVeNguoiCoTienAn;

            if ((phieuThongTinVeNguoiCoTienAnModelImpl.getColumnBitmask() &
                    FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN.getColumnBitmask()) != 0) {
                Object[] args = new Object[] {
                        phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn()
                    };

                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_MASOHOSOTIENANTUTOAAN,
                    args, Long.valueOf(1));
                FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
                    args, phieuThongTinVeNguoiCoTienAn);
            }

            if ((phieuThongTinVeNguoiCoTienAnModelImpl.getColumnBitmask() &
                    FINDER_PATH_FETCH_BY_TIENANID.getColumnBitmask()) != 0) {
                Object[] args = new Object[] {
                        phieuThongTinVeNguoiCoTienAn.getTienAnId()
                    };

                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TIENANID, args,
                    Long.valueOf(1));
                FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_TIENANID, args,
                    phieuThongTinVeNguoiCoTienAn);
            }
        }
    }

    protected void clearUniqueFindersCache(
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn) {
        PhieuThongTinVeNguoiCoTienAnModelImpl phieuThongTinVeNguoiCoTienAnModelImpl =
            (PhieuThongTinVeNguoiCoTienAnModelImpl) phieuThongTinVeNguoiCoTienAn;

        Object[] args = new Object[] {
                phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn()
            };

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_MASOHOSOTIENANTUTOAAN,
            args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
            args);

        if ((phieuThongTinVeNguoiCoTienAnModelImpl.getColumnBitmask() &
                FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN.getColumnBitmask()) != 0) {
            args = new Object[] {
                    phieuThongTinVeNguoiCoTienAnModelImpl.getOriginalMaSoHoSoTienAnTuToaAn()
                };

            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_MASOHOSOTIENANTUTOAAN,
                args);
            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MASOHOSOTIENANTUTOAAN,
                args);
        }

        args = new Object[] { phieuThongTinVeNguoiCoTienAn.getTienAnId() };

        FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TIENANID, args);
        FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_TIENANID, args);

        if ((phieuThongTinVeNguoiCoTienAnModelImpl.getColumnBitmask() &
                FINDER_PATH_FETCH_BY_TIENANID.getColumnBitmask()) != 0) {
            args = new Object[] {
                    phieuThongTinVeNguoiCoTienAnModelImpl.getOriginalTienAnId()
                };

            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TIENANID, args);
            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_TIENANID, args);
        }
    }

    /**
     * Creates a new phieu thong tin ve nguoi co tien an with the primary key. Does not add the phieu thong tin ve nguoi co tien an to the database.
     *
     * @param phieuThongTinVeNguoiCoTienAnId the primary key for the new phieu thong tin ve nguoi co tien an
     * @return the new phieu thong tin ve nguoi co tien an
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn create(
        long phieuThongTinVeNguoiCoTienAnId) {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = new PhieuThongTinVeNguoiCoTienAnImpl();

        phieuThongTinVeNguoiCoTienAn.setNew(true);
        phieuThongTinVeNguoiCoTienAn.setPrimaryKey(phieuThongTinVeNguoiCoTienAnId);

        return phieuThongTinVeNguoiCoTienAn;
    }

    /**
     * Removes the phieu thong tin ve nguoi co tien an with the primary key from the database. Also notifies the appropriate model listeners.
     *
     * @param phieuThongTinVeNguoiCoTienAnId the primary key of the phieu thong tin ve nguoi co tien an
     * @return the phieu thong tin ve nguoi co tien an that was removed
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn remove(
        long phieuThongTinVeNguoiCoTienAnId)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        return remove((Serializable) phieuThongTinVeNguoiCoTienAnId);
    }

    /**
     * Removes the phieu thong tin ve nguoi co tien an with the primary key from the database. Also notifies the appropriate model listeners.
     *
     * @param primaryKey the primary key of the phieu thong tin ve nguoi co tien an
     * @return the phieu thong tin ve nguoi co tien an that was removed
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn remove(Serializable primaryKey)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        Session session = null;

        try {
            session = openSession();

            PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = (PhieuThongTinVeNguoiCoTienAn) session.get(PhieuThongTinVeNguoiCoTienAnImpl.class,
                    primaryKey);

            if (phieuThongTinVeNguoiCoTienAn == null) {
                if (_log.isWarnEnabled()) {
                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
                }

                throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
                    primaryKey);
            }

            return remove(phieuThongTinVeNguoiCoTienAn);
        } catch (NoSuchPhieuThongTinVeNguoiCoTienAnException nsee) {
            throw nsee;
        } catch (Exception e) {
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }

    @Override
    protected PhieuThongTinVeNguoiCoTienAn removeImpl(
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn)
        throws SystemException {
        phieuThongTinVeNguoiCoTienAn = toUnwrappedModel(phieuThongTinVeNguoiCoTienAn);

        Session session = null;

        try {
            session = openSession();

            if (!session.contains(phieuThongTinVeNguoiCoTienAn)) {
                phieuThongTinVeNguoiCoTienAn = (PhieuThongTinVeNguoiCoTienAn) session.get(PhieuThongTinVeNguoiCoTienAnImpl.class,
                        phieuThongTinVeNguoiCoTienAn.getPrimaryKeyObj());
            }

            if (phieuThongTinVeNguoiCoTienAn != null) {
                session.delete(phieuThongTinVeNguoiCoTienAn);
            }
        } catch (Exception e) {
            throw processException(e);
        } finally {
            closeSession(session);
        }

        if (phieuThongTinVeNguoiCoTienAn != null) {
            clearCache(phieuThongTinVeNguoiCoTienAn);
        }

        return phieuThongTinVeNguoiCoTienAn;
    }

    @Override
    public PhieuThongTinVeNguoiCoTienAn updateImpl(
        qldc.pm.tienan.model.PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn)
        throws SystemException {
        phieuThongTinVeNguoiCoTienAn = toUnwrappedModel(phieuThongTinVeNguoiCoTienAn);

        boolean isNew = phieuThongTinVeNguoiCoTienAn.isNew();

        PhieuThongTinVeNguoiCoTienAnModelImpl phieuThongTinVeNguoiCoTienAnModelImpl =
            (PhieuThongTinVeNguoiCoTienAnModelImpl) phieuThongTinVeNguoiCoTienAn;

        Session session = null;

        try {
            session = openSession();

            if (phieuThongTinVeNguoiCoTienAn.isNew()) {
                session.save(phieuThongTinVeNguoiCoTienAn);

                phieuThongTinVeNguoiCoTienAn.setNew(false);
            } else {
                session.merge(phieuThongTinVeNguoiCoTienAn);
            }
        } catch (Exception e) {
            throw processException(e);
        } finally {
            closeSession(session);
        }

        FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

        if (isNew ||
                !PhieuThongTinVeNguoiCoTienAnModelImpl.COLUMN_BITMASK_ENABLED) {
            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
        }
        else {
            if ((phieuThongTinVeNguoiCoTienAnModelImpl.getColumnBitmask() &
                    FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SODINHDANHCANHAN.getColumnBitmask()) != 0) {
                Object[] args = new Object[] {
                        phieuThongTinVeNguoiCoTienAnModelImpl.getOriginalSoDinhDanhCaNhan()
                    };

                FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SODINHDANHCANHAN,
                    args);
                FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SODINHDANHCANHAN,
                    args);

                args = new Object[] {
                        phieuThongTinVeNguoiCoTienAnModelImpl.getSoDinhDanhCaNhan()
                    };

                FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_SODINHDANHCANHAN,
                    args);
                FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_SODINHDANHCANHAN,
                    args);
            }

            if ((phieuThongTinVeNguoiCoTienAnModelImpl.getColumnBitmask() &
                    FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DIACHI.getColumnBitmask()) != 0) {
                Object[] args = new Object[] {
                        phieuThongTinVeNguoiCoTienAnModelImpl.getOriginalNoiThuongTruTinhId(),
                        phieuThongTinVeNguoiCoTienAnModelImpl.getOriginalNoiThuongTruQuanHuyenId(),
                        phieuThongTinVeNguoiCoTienAnModelImpl.getOriginalNoiThuongTruPhuongXaId(),
                        phieuThongTinVeNguoiCoTienAnModelImpl.getOriginalNoiThuongTruDiaChi()
                    };

                FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DIACHI, args);
                FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DIACHI,
                    args);

                args = new Object[] {
                        phieuThongTinVeNguoiCoTienAnModelImpl.getNoiThuongTruTinhId(),
                        phieuThongTinVeNguoiCoTienAnModelImpl.getNoiThuongTruQuanHuyenId(),
                        phieuThongTinVeNguoiCoTienAnModelImpl.getNoiThuongTruPhuongXaId(),
                        phieuThongTinVeNguoiCoTienAnModelImpl.getNoiThuongTruDiaChi()
                    };

                FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DIACHI, args);
                FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DIACHI,
                    args);
            }
        }

        EntityCacheUtil.putResult(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
            PhieuThongTinVeNguoiCoTienAnImpl.class,
            phieuThongTinVeNguoiCoTienAn.getPrimaryKey(),
            phieuThongTinVeNguoiCoTienAn);

        clearUniqueFindersCache(phieuThongTinVeNguoiCoTienAn);
        cacheUniqueFindersCache(phieuThongTinVeNguoiCoTienAn);

        return phieuThongTinVeNguoiCoTienAn;
    }

    protected PhieuThongTinVeNguoiCoTienAn toUnwrappedModel(
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn) {
        if (phieuThongTinVeNguoiCoTienAn instanceof PhieuThongTinVeNguoiCoTienAnImpl) {
            return phieuThongTinVeNguoiCoTienAn;
        }

        PhieuThongTinVeNguoiCoTienAnImpl phieuThongTinVeNguoiCoTienAnImpl = new PhieuThongTinVeNguoiCoTienAnImpl();

        phieuThongTinVeNguoiCoTienAnImpl.setNew(phieuThongTinVeNguoiCoTienAn.isNew());
        phieuThongTinVeNguoiCoTienAnImpl.setPrimaryKey(phieuThongTinVeNguoiCoTienAn.getPrimaryKey());

        phieuThongTinVeNguoiCoTienAnImpl.setPhieuThongTinVeNguoiCoTienAnId(phieuThongTinVeNguoiCoTienAn.getPhieuThongTinVeNguoiCoTienAnId());
        phieuThongTinVeNguoiCoTienAnImpl.setUserId(phieuThongTinVeNguoiCoTienAn.getUserId());
        phieuThongTinVeNguoiCoTienAnImpl.setUserName(phieuThongTinVeNguoiCoTienAn.getUserName());
        phieuThongTinVeNguoiCoTienAnImpl.setCreateDate(phieuThongTinVeNguoiCoTienAn.getCreateDate());
        phieuThongTinVeNguoiCoTienAnImpl.setModifiedDate(phieuThongTinVeNguoiCoTienAn.getModifiedDate());
        phieuThongTinVeNguoiCoTienAnImpl.setTienAnId(phieuThongTinVeNguoiCoTienAn.getTienAnId());
        phieuThongTinVeNguoiCoTienAnImpl.setMaSoHoSoTienAnTuToaAn(phieuThongTinVeNguoiCoTienAn.getMaSoHoSoTienAnTuToaAn());
        phieuThongTinVeNguoiCoTienAnImpl.setNguoiTrichLuc(phieuThongTinVeNguoiCoTienAn.getNguoiTrichLuc());
        phieuThongTinVeNguoiCoTienAnImpl.setThamPhan(phieuThongTinVeNguoiCoTienAn.getThamPhan());
        phieuThongTinVeNguoiCoTienAnImpl.setSoDinhDanhCaNhan(phieuThongTinVeNguoiCoTienAn.getSoDinhDanhCaNhan());
        phieuThongTinVeNguoiCoTienAnImpl.setChuThich(phieuThongTinVeNguoiCoTienAn.getChuThich());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiTamTruDiaChi(phieuThongTinVeNguoiCoTienAn.getNoiTamTruDiaChi());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiTamTruTinhId(phieuThongTinVeNguoiCoTienAn.getNoiTamTruTinhId());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiTamTruQuanHuyenId(phieuThongTinVeNguoiCoTienAn.getNoiTamTruQuanHuyenId());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiTamTruPhuongXaId(phieuThongTinVeNguoiCoTienAn.getNoiTamTruPhuongXaId());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiThuongTruDiaChi(phieuThongTinVeNguoiCoTienAn.getNoiThuongTruDiaChi());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiThuongTruTinhId(phieuThongTinVeNguoiCoTienAn.getNoiThuongTruTinhId());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiThuongTruQuanHuyenId(phieuThongTinVeNguoiCoTienAn.getNoiThuongTruQuanHuyenId());
        phieuThongTinVeNguoiCoTienAnImpl.setNoiThuongTruPhuongXaId(phieuThongTinVeNguoiCoTienAn.getNoiThuongTruPhuongXaId());
        phieuThongTinVeNguoiCoTienAnImpl.setHoTenVoHoacChong(phieuThongTinVeNguoiCoTienAn.getHoTenVoHoacChong());
        phieuThongTinVeNguoiCoTienAnImpl.setHoTenCha(phieuThongTinVeNguoiCoTienAn.getHoTenCha());
        phieuThongTinVeNguoiCoTienAnImpl.setHoTenMe(phieuThongTinVeNguoiCoTienAn.getHoTenMe());

        return phieuThongTinVeNguoiCoTienAnImpl;
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
     *
     * @param primaryKey the primary key of the phieu thong tin ve nguoi co tien an
     * @return the phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findByPrimaryKey(
        Serializable primaryKey)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = fetchByPrimaryKey(primaryKey);

        if (phieuThongTinVeNguoiCoTienAn == null) {
            if (_log.isWarnEnabled()) {
                _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
            }

            throw new NoSuchPhieuThongTinVeNguoiCoTienAnException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
                primaryKey);
        }

        return phieuThongTinVeNguoiCoTienAn;
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an with the primary key or throws a {@link qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException} if it could not be found.
     *
     * @param phieuThongTinVeNguoiCoTienAnId the primary key of the phieu thong tin ve nguoi co tien an
     * @return the phieu thong tin ve nguoi co tien an
     * @throws qldc.pm.tienan.NoSuchPhieuThongTinVeNguoiCoTienAnException if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn findByPrimaryKey(
        long phieuThongTinVeNguoiCoTienAnId)
        throws NoSuchPhieuThongTinVeNguoiCoTienAnException, SystemException {
        return findByPrimaryKey((Serializable) phieuThongTinVeNguoiCoTienAnId);
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an with the primary key or returns <code>null</code> if it could not be found.
     *
     * @param primaryKey the primary key of the phieu thong tin ve nguoi co tien an
     * @return the phieu thong tin ve nguoi co tien an, or <code>null</code> if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByPrimaryKey(
        Serializable primaryKey) throws SystemException {
        PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = (PhieuThongTinVeNguoiCoTienAn) EntityCacheUtil.getResult(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
                PhieuThongTinVeNguoiCoTienAnImpl.class, primaryKey);

        if (phieuThongTinVeNguoiCoTienAn == _nullPhieuThongTinVeNguoiCoTienAn) {
            return null;
        }

        if (phieuThongTinVeNguoiCoTienAn == null) {
            Session session = null;

            try {
                session = openSession();

                phieuThongTinVeNguoiCoTienAn = (PhieuThongTinVeNguoiCoTienAn) session.get(PhieuThongTinVeNguoiCoTienAnImpl.class,
                        primaryKey);

                if (phieuThongTinVeNguoiCoTienAn != null) {
                    cacheResult(phieuThongTinVeNguoiCoTienAn);
                } else {
                    EntityCacheUtil.putResult(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
                        PhieuThongTinVeNguoiCoTienAnImpl.class, primaryKey,
                        _nullPhieuThongTinVeNguoiCoTienAn);
                }
            } catch (Exception e) {
                EntityCacheUtil.removeResult(PhieuThongTinVeNguoiCoTienAnModelImpl.ENTITY_CACHE_ENABLED,
                    PhieuThongTinVeNguoiCoTienAnImpl.class, primaryKey);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return phieuThongTinVeNguoiCoTienAn;
    }

    /**
     * Returns the phieu thong tin ve nguoi co tien an with the primary key or returns <code>null</code> if it could not be found.
     *
     * @param phieuThongTinVeNguoiCoTienAnId the primary key of the phieu thong tin ve nguoi co tien an
     * @return the phieu thong tin ve nguoi co tien an, or <code>null</code> if a phieu thong tin ve nguoi co tien an with the primary key could not be found
     * @throws SystemException if a system exception occurred
     */
    @Override
    public PhieuThongTinVeNguoiCoTienAn fetchByPrimaryKey(
        long phieuThongTinVeNguoiCoTienAnId) throws SystemException {
        return fetchByPrimaryKey((Serializable) phieuThongTinVeNguoiCoTienAnId);
    }

    /**
     * Returns all the phieu thong tin ve nguoi co tien ans.
     *
     * @return the phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findAll()
        throws SystemException {
        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
    }

    /**
     * Returns a range of all the phieu thong tin ve nguoi co tien ans.
     *
     * <p>
     * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
     * </p>
     *
     * @param start the lower bound of the range of phieu thong tin ve nguoi co tien ans
     * @param end the upper bound of the range of phieu thong tin ve nguoi co tien ans (not inclusive)
     * @return the range of phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findAll(int start, int end)
        throws SystemException {
        return findAll(start, end, null);
    }

    /**
     * Returns an ordered range of all the phieu thong tin ve nguoi co tien ans.
     *
     * <p>
     * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.PhieuThongTinVeNguoiCoTienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
     * </p>
     *
     * @param start the lower bound of the range of phieu thong tin ve nguoi co tien ans
     * @param end the upper bound of the range of phieu thong tin ve nguoi co tien ans (not inclusive)
     * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
     * @return the ordered range of phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public List<PhieuThongTinVeNguoiCoTienAn> findAll(int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
        boolean pagination = true;
        FinderPath finderPath = null;
        Object[] finderArgs = null;

        if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
                (orderByComparator == null)) {
            pagination = false;
            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
            finderArgs = FINDER_ARGS_EMPTY;
        } else {
            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
            finderArgs = new Object[] { start, end, orderByComparator };
        }

        List<PhieuThongTinVeNguoiCoTienAn> list = (List<PhieuThongTinVeNguoiCoTienAn>) FinderCacheUtil.getResult(finderPath,
                finderArgs, this);

        if (list == null) {
            StringBundler query = null;
            String sql = null;

            if (orderByComparator != null) {
                query = new StringBundler(2 +
                        (orderByComparator.getOrderByFields().length * 3));

                query.append(_SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN);

                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
                    orderByComparator);

                sql = query.toString();
            } else {
                sql = _SQL_SELECT_PHIEUTHONGTINVENGUOICOTIENAN;

                if (pagination) {
                    sql = sql.concat(PhieuThongTinVeNguoiCoTienAnModelImpl.ORDER_BY_JPQL);
                }
            }

            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(sql);

                if (!pagination) {
                    list = (List<PhieuThongTinVeNguoiCoTienAn>) QueryUtil.list(q,
                            getDialect(), start, end, false);

                    Collections.sort(list);

                    list = new UnmodifiableList<PhieuThongTinVeNguoiCoTienAn>(list);
                } else {
                    list = (List<PhieuThongTinVeNguoiCoTienAn>) QueryUtil.list(q,
                            getDialect(), start, end);
                }

                cacheResult(list);

                FinderCacheUtil.putResult(finderPath, finderArgs, list);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(finderPath, finderArgs);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return list;
    }

    /**
     * Removes all the phieu thong tin ve nguoi co tien ans from the database.
     *
     * @throws SystemException if a system exception occurred
     */
    @Override
    public void removeAll() throws SystemException {
        for (PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn : findAll()) {
            remove(phieuThongTinVeNguoiCoTienAn);
        }
    }

    /**
     * Returns the number of phieu thong tin ve nguoi co tien ans.
     *
     * @return the number of phieu thong tin ve nguoi co tien ans
     * @throws SystemException if a system exception occurred
     */
    @Override
    public int countAll() throws SystemException {
        Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
                FINDER_ARGS_EMPTY, this);

        if (count == null) {
            Session session = null;

            try {
                session = openSession();

                Query q = session.createQuery(_SQL_COUNT_PHIEUTHONGTINVENGUOICOTIENAN);

                count = (Long) q.uniqueResult();

                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
                    FINDER_ARGS_EMPTY, count);
            } catch (Exception e) {
                FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
                    FINDER_ARGS_EMPTY);

                throw processException(e);
            } finally {
                closeSession(session);
            }
        }

        return count.intValue();
    }

    /**
     * Initializes the phieu thong tin ve nguoi co tien an persistence.
     */
    public void afterPropertiesSet() {
        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
                    com.liferay.util.service.ServiceProps.get(
                        "value.object.listener.qldc.pm.tienan.model.PhieuThongTinVeNguoiCoTienAn")));

        if (listenerClassNames.length > 0) {
            try {
                List<ModelListener<PhieuThongTinVeNguoiCoTienAn>> listenersList = new ArrayList<ModelListener<PhieuThongTinVeNguoiCoTienAn>>();

                for (String listenerClassName : listenerClassNames) {
                    listenersList.add((ModelListener<PhieuThongTinVeNguoiCoTienAn>) InstanceFactory.newInstance(
                            getClassLoader(), listenerClassName));
                }

                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
            } catch (Exception e) {
                _log.error(e);
            }
        }
    }

    public void destroy() {
        EntityCacheUtil.removeCache(PhieuThongTinVeNguoiCoTienAnImpl.class.getName());
        FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
        FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
        FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    }
}
